﻿using MediatR;
using S_Gridding.Api.Application.Commands.MeshType;
using S_Gridding.Infrastructure.Interface.IWrite;

namespace S_Gridding.Api.Application.CommandsHanders.MeshTypeHanders
{
    /// <summary>
    /// sqlsugar 网格类型管理表的单个逻辑删除
    /// </summary>
    public class MeshTypeSqlSuageFalseDeleteCommandHander : IRequestHandler<MeshTypeSqlSuageFalseDeleteCommand, int>
    {
        private readonly IMeshTypeRepository _meshTypeRepository;  //网格类型管理表仓储接口

        public MeshTypeSqlSuageFalseDeleteCommandHander(IMeshTypeRepository meshTypeRepository)
        {
            _meshTypeRepository = meshTypeRepository;
        }
        public async Task<int> Handle(MeshTypeSqlSuageFalseDeleteCommand request, CancellationToken cancellationToken)
        {
            var list = await _meshTypeRepository.GetFindAsync(request.MeshTypeId);
            list.IsDel = true;
            return await _meshTypeRepository.UpdateAsync(list);
        }
    }
}
